/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:
 * Date: 2024-07-19
 * Time: 18:56
 */
public class Test {
    public static void main(String[] args) {

    }


    public static int finall(int[] array, int index){
        if(array == null){
            throw  new NullPointerException("传递的数组为空数组");
        }

        if(index < 0 || index > array.length){
            throw new ArrayIndexOutOfBoundsException("传递的数组下标越界");
        }

        return array[index];
    }
    public static void main2(String[] args) {
        int[] arr = {1,2,3,} ;
        finall(arr,4);
    }

    public static void main1(String[] args) {
        //System.out.println(10 / 0);
        /*int[] arr = {1,2,3};
        System.out.println(arr[4]);*/

        /*int[] arr = null;
        System.out.println(arr.length);*/


    }
}
